<template>
    <dialog-editor ref="dialog"></dialog-editor>
</template>

<script>
  import DialogEditor from '@/components/DialogEditor'
  import dialogMixins from '@/utils/commonDialogMixins'
  export default {
    mixins: [dialogMixins],
    components: {DialogEditor},
    data () {
      return {
        dataFormConfig: {
          id: {
            hidden: true
          },
          deepProductNo: {
            label: '产品编号',
            placeholder: '请输入产品编号'
          },
          colorNo: {
            label: '产品颜色',
            placeholder: '请输入产品颜色'
          },
          deepTypeList: {
            label: '深加工种类',
            placeholder: '请选择深加工种类',
            selectMultiple: true,
            type: 'list',
            clearable: true,
            list: []
          },
          productImage: {
            label: '产品图片',
            type: 'uploadImage',
            imageType: 'uploadProductImage'
          },
          remark: {
            label: '产品备注',
            inputType: 'textarea',
            placeholder: '请输入产品备注'
          },

          status: {
            label: '状态',
            type: 'switch',
            activeValue: 1,
            inactiveValue: 0,
            default: 1
          }
        }
      }
    },
    methods: {
      //initDeepCategoryListByJiMei

      init(id,property,cb) {
        this.initDeepCategoryListByJiMei('deepTypeList')
        this.dataForm.id = id || 0
        this.$refs.dialog.initDialog({
          dataForm: this.dataForm,
          config: this.dataFormConfig,
          dataRule: this.getNeedDataRule('deepProductNo', 'status'),
          initApi: 'deepApi/deepProductInfo',
          saveApi: 'deepApi/saveDeepProductInfo',
          updateApi: 'deepApi/updateDeepProductInfo',
          objectName: 'deepProductInfo',
          submitCallback: cb
        })
      }
    }
  }
</script>
